<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="font/iconfont.css">
    <link rel="stylesheet" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/site.css">
    <script src="js/viewport.js"></script>
    <script src="js/swiper.min.js"></script>
    <script src="js/jquery-1.8.3.js"></script>
    <script src="js/public.js"></script>
    <script src="js/vue.min.js"></script>
    <script src="js/axios.js"></script>
    <script src="js/qs.js"></script>
</head>

<body>
<div id="app">
    <header class="padding-35">
        <div class="logo">
            <img src="imgs/logo.png" alt="">
        </div>
        <div class="menu">
            <img src="imgs/menu.png" alt="">
        </div>
    </header>
    <div class="mbx padding-35">
        <a href="index.html">健康美食网</a>
        <i class="iconfont icon-arrow-right-copy-copy"></i>
        <span>食材</span>
    </div>
    <div class="search">
        <div class="searchBox padding-35">
            <input type="text" placeholder="搜索菜谱、食材、菜单、用户">
            <img src="imgs/fangdajing.png" alt="" srcset="">
        </div>
    </div>
    <div class="foodAdv padding-35">
        <img src="imgs/foodAdv.png" alt="">
    </div>
    <div class="foodContent clearfix">
        <div class="foodContentL fl">
            <ul>
                <li>时令食材</li>
                <li>肉禽蛋</li>
                <li>水产类</li>
                <li>蔬果类</li>
            </ul>
        </div>
        <div class="foodContentR fl">
            <div class="typeBox none">
                <div>
                    <div class="typeBoxTit">
                        <span></span>
                        <i>时令食材</i>
                    </div>
                    <div class="typeBoxList">
                        <ul class="clearfix">
                            <li v-for="f in food"><a href="javascript:;" @click.prevent="tz('foodDetail.html?cid=',f.fid)">{{f.fname}}</a></li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="typeBox">
                <div>
                    <div class="typeBoxTit">
                        <span></span>
                        <i>肉禽蛋</i>
                    </div>
                    <div class="typeBoxList lastChange">
                        <ul class="clearfix">
                            <li v-for="f in food"><a href="javascript:;" @click.prevent="tz('foodDetail.html?cid=',f.fid)">{{f.fname}}</a></li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="typeBox none">
                <div class="typeBoxTit">
                    <span></span>
                    <i>水产类</i>
                </div>
                <div class="typeBoxList">
                    <ul class="clearfix">
                        <li v-for="f in food"><a href="javascript:;" @click.prevent="tz('foodDetail.html?cid=',f.fid)">{{f.fname}}</a></li>
                    </ul>
                </div>
            </div>
            <div class="typeBox none">
                <div class="typeBoxTit">
                    <span></span>
                    <i>蔬果类</i>
                </div>
                <div class="typeBoxList">
                    <ul class="clearfix">
                        <li v-for="f in food"><a href="javascript:;" @click.prevent="tz('foodDetail.html?cid=',f.fid)">{{f.fname}}</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <footer>
        <p>版权所有：版权所有：健康美食网 WWW.JKMEISHI.COM</p>
        <p>Copyright 2011-2018 备案号:鄂ICP备11013833号-4</p>
    </footer>
</div>
<script>
    var v = new Vue({
        el : "#app",
        data:{
            food : {}
        },
        created(){
            this.queryBytype("肉禽蛋");
        },
        methods:{
            queryBytype(type){
                axios.post("healthy/food/querybyftype", qs.stringify({type : type})).then(res=>{
                    this.food = res.data.data;
                    console.log(this.food);
                })
            },
            tz(detail,id) {
                // location.href ="cuisineDetail.html?cid="+id;
                location.href = detail + id;
            }
        }

    })
    $('.foodContentL ul li').click(function () {
        var type = $(this).text();
        console.log(type)
        v.queryBytype(type);
    })
</script>
</body>

</html>